﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class Templates_Popup : CrossFactory.SiteNote.Hierarchy.SiteNotePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        System.Web.UI.HtmlControls.HtmlLink htmlLink;
        foreach (Control ctrl in this.head.Controls)
        {
            if (ctrl is System.Web.UI.HtmlControls.HtmlLink)
            {
                htmlLink = (System.Web.UI.HtmlControls.HtmlLink)ctrl;
                htmlLink.Href = htmlLink.Href.Replace("%CurrentDesign%", CrossFactory.SiteNote.Components.Utils.GetCurrentDesign());
            }
        }

        if (this.Page is CrossFactory.SiteNote.Hierarchy.SiteNotePage)
        {
            if (this.Page.Header != null)
            {
                this.Page.Header.Title = ((CrossFactory.SiteNote.Hierarchy.SiteNotePage)this.Page).SiteNotePageInfo.Title;
                foreach (Control ctrl in this.Page.Header.Controls)
                {
                    if (ctrl is HtmlMeta)
                    {
                        switch (((HtmlMeta)ctrl).Name.ToLower())
                        {
                            case "keywords":
                                ((HtmlMeta)ctrl).Content = ((CrossFactory.SiteNote.Hierarchy.SiteNotePage)this.Page).SiteNotePageInfo.Keywords;
                                break;
                            case "description":
                                ((HtmlMeta)ctrl).Content = ((CrossFactory.SiteNote.Hierarchy.SiteNotePage)this.Page).SiteNotePageInfo.Description;
                                break;
                            default:
                                break;
                        }
                    }
                }
            }
        }
    }
}
